import request from '@/api/request'
import g from "@/utils/utilFn";
export function getlist(param) {
    param = g.objEngraving({
        department: "",
        group: "",
        page: 1,
        limit: 20,
        filed: 'id',
        sort: 'ascending'
    }, param || {})
    let data = new FormData()
    Object.keys(param).map((key) => {
        data.append(key, param[key] || "");
    });
    return request({
        url: '/org_department/getlist',
        method: 'POST',
        data
    })
}

export function remove_by_id(id) {
    let data = new FormData()
    data.append("id", id || "");
    return request({
        url: '/org_department/delete_by_id',
        method: 'POST',
        data
    })
}

export function update(param) {
    param = g.objEngraving({
        id: "",
        department: "",
        group: "",
    }, param || {})
    let data = new FormData()
    Object.keys(param).map((key) => {
        data.append(key, param[key] || "");
    });
    return request({
        url: '/org_department/update',
        method: 'POST',
        data
    })
}

export function notExistAdd(param) {
    param = g.objEngraving({
        department: "",
        group: "",
    }, param || {})
    let data = new FormData()
    Object.keys(param).map((key) => {
        data.append(key, param[key] || "");
    });
    return request({
        url: '/org_department/notExistAdd',
        method: 'POST',
        data
    })
}